package com.cn.zpark;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @PackageName: com.cn.zpark
 * @ClassName: CookieDemo01
 * @Description:
 * @author: RZS
 * @date: 2022/4/14  11:08
 */
@WebServlet("/cook1")
public class CookieDemo01 extends HttpServlet {
    @Override
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 创建cookie对象
        Cookie c1 = new Cookie("java", "张三");
        Cookie c2 = new Cookie("Python", "zhangsan");

        // 设置cookie响应
        response.addCookie(c1);
        response.addCookie(c2);

    }
}
